#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{
  int fd = open("fifo", O_WRONLY);
  if(fd >= 0)
  {
    char buffer[64];
    while(1)
    {
      printf("客户端-请输入消息：");
      fflush(stdout);
      ssize_t ret = read(0, buffer, sizeof(buffer) - 1);
    

      if(ret > 0)
      {
        buffer[ret] = '\0';
        write(fd, buffer, ret);
      }

    }
  }
  return 0;

}
